<template>
  <div class="printForm">
    <!-- <div class="area-header">
      <span class="area-header-title">{{ $t('申请单') }}</span>
    </div> -->
    <table class="printTable">
      <tr>
        <td class="tit">{{ $t('项目名称') }}</td>
        <td colspan="3">{{ form.dealName }}</td>
      </tr>
      <tr>
        <td class="tit">{{ $t('项目负责人') }}</td>
        <td>
          {{ form.dealPerson }}
        </td>
        <td class="tit">{{ $t('跟投总金额') }}</td>
        <td>
          {{ moneyFormat(form.sumMoney) }}
        </td>
      </tr>
      <tr>
        <td class="tit">{{ $t('跟投方式') }}</td>
        <td colspan="3">
          {{ form.followWay }}
        </td>
      </tr>
      <tr>
        <td class="tit">{{ $t('备注') }}</td>
        <td colspan="3">
          {{ form.remark }}
        </td>
      </tr>
    </table>
    <div class="area-header">
      <span class="area-header-title">{{ $t('跟投详情') }}</span>
    </div>
    <table class="previewTable">
      <thead>
        <th>{{ $t('跟投人') }}</th>
        <th>{{ $t('跟投金额') }}</th>
        <th>{{ $t('跟投比例') }}</th>
        <th>{{ $t('备注') }}</th>
      </thead>
      <tbody>
        <tr v-for="(v, ind) in form.investmentDetailsList" :key="ind">
          <td><UserSelect v-model="v.followPerson" /></td>
          <td>{{ moneyFormat(v.followMoney) }}</td>
          <td>{{ v.followRatio }}</td>
          <td>{{ v.remark }}</td>
        </tr>
      </tbody>
    </table>
    <FileView :list.sync="form.fileList" data-type="deal_user_investment" />
  </div>
</template>

<script>
import { getDealUserInvestment } from '@/api/deal/follow/investment/dealUserInvestment'

export default {
  data() {
    return {
      // 表单参数
      form: {},
      // 遮罩层
      loading: false
    }
  },
  created() {
    this.$bus.$emit('async_done')
  },
  methods: {
    // 初始化数据
    init(data) {
      console.log('data', data)
      this.loading = true
      if (data != null && data.id !== undefined) {
        getDealUserInvestment(data.id).then(response => {
          this.form = response.data
          this.loading = false
        })
      } else {
        this.loading = false
      }
    }
  }

}
</script>
